#!/bin/sh

set -o nounset
set -o errexit

set -x

BUILD_TYPE=build

echo "CI_COMMIT_REF_NAME = $CI_COMMIT_REF_NAME"

if [ "x-$CI_COMMIT_REF_NAME" = "x-testing" ]; then
    BUILD_TYPE="build-testing"
    echo "setting testing"
else
    echo "setting no-testing"
fi

BUILD_TYPE=build

export BUILD_TYPE

echo "BUILD_TYPE = $BUILD_TYPE"


npm install --registry=https://registry.npm.taobao.org
npm run ${BUILD_TYPE}
echo $CI_COMMIT_SHORT_SHA > dist/_git_rev.txt
